<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/jstl/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/jstl/fn.tld" prefix="fn"%>
<%@ taglib uri="/WEB-INF/jstl/spring-form.tld" prefix="form"%>
<%@ taglib uri="/WEB-INF/jstl/spring.tld" prefix="spring"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>搜索结果页面</title>
<!--标题图标-->
<link rel="shortcut icon" type="image/x-icon"
	href="<%=basePath%>assets/x-img/logo-title.ico" media="screen" />

<link rel="stylesheet" type="text/css"
	href="<%=basePath%>assets/bootstrap/css/resetPro.css">
<link
	href="<%=basePath%>assets/bootstrap/css/bootstrap-combined.min.css"
	rel="stylesheet">
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/js/jquery-2.0.0.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/js/jquery-ui.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/js/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/js/jquery.htmlClean.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/ckeditor/ckeditor.js"></script>
<script type="text/javascript"
	src="<%=basePath%>assets/bootstrap/ckeditor/config.js"></script>
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>assets/bootstrap/Font-Awesome-3.2.1/css/font-awesome.min.css">
<!--这个js有时候会冲突-->
<!--<script type="text/javascript" src="<%=basePath%>bootstrap/js/scripts.js"></script>-->
<link rel="stylesheet"
	href="<%=basePath%>assets/onedate/css/BeatPicker.min.css" />
<script src="<%=basePath%>assets/onedate/js/BeatPicker.min.js"></script>
<script src="<%=basePath%>assets/onedate/documents/js/prism.js"></script>

<style type="text/css">
.onediv {
	margin: 0px 5px;
	display: inline-block;
}
a{
cursor:pointer!important;
}
a:hover {
	text-decoration: none !important;
}

.alldiv {
	width: 100%;
	margin: 0 auto;
	text-align: center;
}

strong {
	margin-right: 10px;
}

.borderStrong {
	border: 5px solid #dee5e5;
}

.z5 {
	margin: 0 10px;
}

.z6 {
	margin-right: 10px;
}

.changeherodiv {
	padding: 40px;
}

.goodsdiv {
	width: 220px;
	text-align: left;
}

.topdiv {
	z-index: 1000; /*设置层叠优先级*/
	position: fixed;
	top: 0px;
	width: 94%;
}

.goodsdiv img {
	height: 140px;
	margin-bottom: 5px;
}

.zerodiv {
	margin-top: 25px;
}

.keyinput {
	margin-bottom: 0px !important;
}

.left-div {
	position: absolute;
	right: 0px;
	top: 3px;
}
</style>
</head>
<body style="min-height: 660px; cursor: auto;" class="edit">
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<!--引入Top导航-->
				<%@include file="member/shared/pageTop.jsp"%>
			</div>
		</div>
		<div class="row-fluid zerodiv">
			<div class="span12">

				<div class="row-fluid">
					<div class="span12">


						<div class="row-fluid ">
							<div class="span12 ">
								<ul class="breadcrumb" style="position: relative;">
									<li><a href="#">首页</a> <span
										class="divider icon-chevron-right"></span></li>
									<li class="active">${tip}</li>
									<div class="left-div">
										<!-- 简单查询 -->
										<form class=" text-right " action="<%=basePath%>search"
											method="get">
											<input type="text" id="keys" name="keys" class="keyinput" value="${keys}" placeholder="关键字..." >
											<div class="btn-group pull-right">
												<button class="btn  btn-success " type="submit">
													<span class="icon-search "></span>&nbsp;&nbsp;搜索
												</button>
												<a class="btn dropdown-toggle btn-success "
													data-toggle="dropdown" href="#"> <span class="caret"></span>
												</a>
												<ul class="dropdown-menu ">
													<li><a   onclick='searchMine("ONLYBRAND");'><span class="icon-search z5"></span>&nbsp;&nbsp;按品牌名搜索</a>
													</li>
													<li><a  onclick='searchMine("ONLYNAME");'><span class="icon-search z5"></span>&nbsp;&nbsp;按商品名搜索</a>
													</li>
													<!-- <li><a href="#"><span class="icon-search z5"></span>&nbsp;&nbsp;按分类名搜索</a>
													</li> -->
												</ul>
											</div>

										</form>

									</div>
								</ul>
								<!-- 显示提示信息 -->
								<%@include file="admin/shared/info.jsp"%>
								<div class="alldiv">

									<%-- <div class="onediv">
									 <div class="hero-unit changeherodiv">
									 	<div class="goodsdiv">
									 		<img src="<%=basePath%>assets/goodsimg/lumia.jpg"/>
									 		<div><span class="z6">名称</span><span></span></div>
								 			<div><span class="z6">单价</span><span></span></div>
								 			<button type="button"  class="btn btn-success btn-block" 
												onclick="javascript:window.location.href='<%=basePath%>goods/edit/${goods.id}?oper=oneGoods';">
											<span class="icon-eye-open cheSpan"></span>商品详情</button>
											<button type="button"  class="btn btn-info btn-block" 
												onclick="javascript:window.location.href='<%=basePath%>goods/edit/${goods.id}?oper=editGoods';">
											<span class="icon-edit cheSpan"></span>加入购物车</button>
									 	</div>
									</div>
								</div> --%>
									<!-- 判断商品列表是否合法 -->
									<c:choose>
										<c:when
											test="${( empty goodsPageInfo.basePageList ) or (fn:length(goodsPageInfo.basePageList)<1)}">
											<h4 class="text-center text-error">商品列表为空</h4>
										</c:when>
										<c:otherwise>
											<!-- 循环取出分页商品 -->
											<c:forEach items="${goodsPageInfo.basePageList}" var="goods">

												<div class="onediv">
													<div class="hero-unit changeherodiv">
														<div class="goodsdiv">
															<c:choose>
																<c:when test="${empty goods.img}">
																	<img src="<%=basePath%>assets/goodsimg/404.ico" />
																</c:when>
																<c:otherwise>
																	<img src="<%=basePath%>assets/goodsimg/${goods.img}" />
																</c:otherwise>
															</c:choose>
															<div>
																<span class="z6">名称</span><span>${goods.name}</span>
															</div>
															<div>
																<span class="z6">单价</span><span class="z6">${goods.price}</span>(￥)
															</div>
															<button type="button" class="btn btn-success btn-block"
																onclick="javascript:window.location.href='<%=basePath%>show/${goods.id}';">
																<span class="  icon-info-sign z5"></span>商品详情
															</button>
															<button type="button" class="btn btn-info btn-block"
																onclick="javascript:window.location.href='<%=basePath%>cart/add?id=${goods.id}&num=1&sendPage=search'
																	+'&groupId=${groupId}&listName=${listName}&searchType=${searchType }&keys=${keys}'
																	+'&pageSize=${goodsPageInfo.pageSize}&pageCount=${goodsPageInfo.pageCount}&nowPage=${goodsPageInfo.nowPage}';">
																<span class="icon-shopping-cart  z5"></span>加入购物车
															</button>
														</div>
													</div>
												</div>

											</c:forEach>
										</c:otherwise>
									</c:choose>
								</div>

								<!--分页控制 -->
								<table class="table foottable">
									<tbody>
										<tr>
											<td>
												<div class="uldiv pagination pagination-left ">
													<span class="label badge-info">商品数:</span><span
														class="label badge-info">${goodsPageInfo.rootListSize}</span>
													<span class="label badge-success">页面大小:</span> <span
														class="label badge-success">
														${goodsPageInfo.pageSize} </span> <span
														class="label badge-important">当前页:</span><span
														class="label badge-important">${goodsPageInfo.nowPage}</span>
												</div>
											</td>
											<td>
												<div class="pagination pagination-right">
													<ul class="oneul">
														<li><a
															href="<%=basePath%>search?groupId=${groupId}&listName=${listName}&searchType=${searchType }
																		&pageSize=${goodsPageInfo.pageSize}&nowPage=${goodsPageInfo.nowPage-1}&keys=${keys}">上一页</a>
														</li>
														<c:forEach items="${goodsPageInfo.pageNoList}" var="no">
															<c:choose>
																<c:when test="${no ne -1}">
																	<li><a
																		href="<%=basePath%>search?groupId=${groupId}&listName=${listName}&searchType=${searchType }
																		&pageSize=${goodsPageInfo.pageSize}&nowPage=${no==0?1:no}&keys=${keys}">${no==0?'...':no}</a>
																	</li>
																</c:when>
																<c:otherwise></c:otherwise>
															</c:choose>
														</c:forEach>
														<li><a
															href="<%=basePath%>search?groupId=${groupId}&listName=${listName}&searchType=${searchType }
																&pageSize=${goodsPageInfo.pageSize}&pageCount=${goodsPageInfo.pageCount}&nowPage=${goodsPageInfo.nowPage+1}&keys=${keys}">下一页</a>
														</li>
													</ul>
												</div>
											</td>
										</tr>
									</tbody>
								</table>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
 function searchMine(type){
	 var keys=$('#keys').val();
	 window.location.href="<%=basePath%>search?searchType="+type+"&keys="+keys;
 }

</script>
</html>
